<%@page contentType="text/html; charset=utf-8" language="java" %>
<%@page import="biz.UserBiz" %>
<%@page import="bean.User" %>
<html>
	<head>
		<link href="css.css" rel="stylesheet" type="text/css">
		<title>欢迎登陆iWiki</title>
		<%
		String action = request.getParameter("action");
		if((action != null) && action.equals("login")){
			
			boolean flag = UserBiz.LoginCheck(request.getParameter("uname"),request.getParameter("upass"));
			if(flag){
				User user = UserBiz.getUserByUname(request.getParameter("uname"));
				session.setAttribute("uid",user.getUid());
				out.print("<script>alert('登录成功，即将转向您的页面！');history.back();</script>");
				response.sendRedirect("user.jsp");
			}else{
				out.print("<script>alert('登录失败，请检查用户名与密码！');history.back();</script>");
			}
		}
		%>
	</head>
	<body>
		<jsp:include page="/head.jsp"/>
		<div class="container">
			<p>
			还没有账号？请点击<a href="regist.jsp">这里</a>注册。
			</p>
			<center><fieldset>
			<p class="f_title">登录到iWiki</p>
			<div class="disc">登陆到您的iWiki账号，开始用iWiki帮您工作</div>
			<form method="post" action="login.jsp?action=login">
				<ol>
				<li><label for="uname">用户名：</label><span><input type="text" name="uname" class="input" style="width:180px;"></span></li>
				<li><label for="upass"><span id="blank">&nbsp;&nbsp;</span>密码：</label><span><input type="password" name="upass" class="input" style="width:180px;"></span></li>
				</ol>
				<input type="submit" value="登录" style="width:60px" class="button"/>
				<input type="reset" value="重填" style="width:60px" class="button"/>	
			</form>
			</fieldset></center>
		</div>
		<jsp:include page="/copyright.html"/>
	</body>
</html>